<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MySQL调优实战：从蜗牛到猎豹的蜕变之旅</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.6;
            color: #333;
            background-color: #f9fafb;
        }
        h1, h2, h3, h4, h5 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
            margin-top: 1.5em;
            margin-bottom: 0.75em;
        }
        .hero {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            color: white;
        }
        .code-block {
            background-color: #1e293b;
            color: #f8fafc;
            border-radius: 0.5rem;
            overflow-x: auto;
        }
        .card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .highlight {
            position: relative;
            z-index: 1;
        }
        .highlight:before {
            content: '';
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 30%;
            background-color: rgba(167, 139, 250, 0.3);
            z-index: -1;
            transition: height 0.3s ease;
        }
        .highlight:hover:before {
            height: 50%;
        }
        .footer {
            background-color: #1a1a1a;
            color: #e5e7eb;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero py-20 md:py-32 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0 md:pr-10">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4">从蜗牛到猎豹</h1>
                    <h2 class="text-2xl md:text-3xl font-semibold mb-6">一个电商系统的MySQL调优蜕变之旅</h2>
                    <p class="text-xl opacity-90 mb-8">探索MySQL 8.0新特性如何将数据库性能提升10倍，解锁电商系统的真正潜力</p>
                    <div class="flex space-x-4">
                        <a href="#problem" class="bg-white text-indigo-600 hover:bg-indigo-50 px-6 py-3 rounded-lg font-medium transition duration-300">问题诊断</a>
                        <a href="#solutions" class="border-2 border-white text-white hover:bg-white hover:text-indigo-600 px-6 py-3 rounded-lg font-medium transition duration-300">解决方案</a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <img src="https://cdn.nlark.com/yuque/0/2025/png/21449790/1741932382159-8d7c9ee0-3f74-4b2e-b355-f672e98fd217.png" alt="数据库性能优化" class="rounded-xl shadow-2xl border-4 border-white">
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-4xl px-4 py-12">
        <!-- Problem Section -->
        <section id="problem" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-600 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold">一、从蜗牛到猎豹：一个电商系统的蜕变之旅</h2>
            </div>
            <div class="bg-white rounded-xl shadow-lg p-8 mb-8">
                <p class="text-lg mb-6">某电商平台在促销期间遭遇数据库危机：</p>
                <div class="grid md:grid-cols-3 gap-6 mb-8">
                    <div class="bg-rose-50 p-6 rounded-lg">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-stopwatch text-rose-500 text-2xl mr-3"></i>
                            <h3 class="font-bold text-lg">查询响应</h3>
                        </div>
                        <p class="text-gray-700">从<span class="font-bold text-rose-600">200ms</span>暴增至<span class="font-bold text-rose-600">5秒</span></p>
                    </div>
                    <div class="bg-amber-50 p-6 rounded-lg">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-microchip text-amber-500 text-2xl mr-3"></i>
                            <h3 class="font-bold text-lg">CPU使用率</h3>
                        </div>
                        <p class="text-gray-700">持续<span class="font-bold text-amber-600">100%</span>高位运行</p>
                    </div>
                    <div class="bg-blue-50 p-6 rounded-lg">
                        <div class="flex items-center mb-2">
                            <i class="fas fa-bug text-blue-500 text-2xl mr-3"></i>
                            <h3 class="font-bold text-lg">错误日志</h3>
                        </div>
                        <p class="text-gray-700">频繁出现<span class="font-bold text-blue-600">"Lock wait timeout"</span></p>
                    </div>
                </div>
                <p class="text-lg mb-6">通过MySQL调优和8.0新特性的应用，最终实现：</p>
                <div class="bg-green-50 p-6 rounded-lg border-l-4 border-green-500">
                    <div class="flex items-start mb-2">
                        <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                        <p class="text-gray-700"><span class="font-bold">查询性能提升10倍</span> - 从5秒降至500ms</p>
                    </div>
                    <div class="flex items-start mb-2">
                        <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                        <p class="text-gray-700"><span class="font-bold">高峰期并发处理能力翻倍</span> - 支持更多促销用户</p>
                    </div>
                    <div class="flex items-start">
                        <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                        <p class="text-gray-700"><span class="font-bold">锁冲突降低90%</span> - 系统稳定性显著提升</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Basic Optimization -->
        <section id="basics" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-600 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold">二、调优基础：人人都要掌握的黄金法则</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <!-- 2.1 索引优化实战 -->
                <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-2xl font-bold mb-4 highlight">2.1 索引优化实战（图书馆找书理论）</h3>
                        <p class="mb-4">错误示范：全表扫描就像在图书馆里一本书一本书地找，效率极低</p>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm"><code>-- 错误示范：全表扫描
SELECT * FROM orders WHERE YEAR(create_time) = 2023;</code></pre>
                        </div>
                        <p class="mb-4">优化方案：建立合适的索引就像使用图书目录系统</p>
                        <div class="code-block p-4">
                            <pre class="text-sm"><code>-- 优化方案：索引优化
ALTER TABLE orders ADD INDEX idx_created_at (create_time);
SELECT * FROM orders WHERE create_time BETWEEN '2023-01-01' AND '2023-12-31';</code></pre>
                        </div>
                    </div>
                </div>
                
                <!-- 2.2 执行计划解读 -->
                <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                    <div class="p-6">
                        <h3 class="text-2xl font-bold mb-4 highlight">2.2 执行计划解读（EXPLAIN解密）</h3>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm"><code>EXPLAIN FORMAT=JSON 
SELECT p.name, COUNT(*) 
FROM products p
JOIN order_items oi ON p.id = oi.product_id
GROUP BY p.id;</code></pre>
                        </div>
                        <div class="bg-gray-50 p-4 rounded-lg">
                            <h4 class="font-bold mb-2">关键指标解析：</h4>
                            <div class="flex items-center mb-1">
                                <i class="fas fa-arrow-right text-indigo-500 mr-2"></i>
                                <span><span class="font-semibold">type</span>：ALL（全表扫描）→ index（索引扫描）</span>
                            </div>
                            <div class="flex items-center mb-1">
                                <i class="fas fa-arrow-right text-indigo-500 mr-2"></i>
                                <span><span class="font-semibold">rows</span>：10000 → 200</span>
                            </div>
                            <div class="flex items-center">
                                <i class="fas fa-arrow-right text-indigo-500 mr-2"></i>
                                <span><span class="font-semibold">Extra</span>：Using temporary → Using index</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- MySQL 8.0 Features -->
        <section id="features" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-600 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold">三、MySQL 8.0六大杀手级特性</h2>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6 mb-10">
                <!-- Feature 1 -->
                <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-3">
                            <div class="w-8 h-8 bg-indigo-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-project-diagram text-indigo-600"></i>
                            </div>
                            <h3 class="text-xl font-bold">3.1 通用表表达式（CTE）</h3>
                        </div>
                        <p class="text-gray-600 mb-4">递归查询组织架构树等层次结构数据</p>
                        <div class="code-block p-4 text-xs">
                            <pre><code>WITH RECURSIVE org_tree AS (
    SELECT id, name, parent_id 
    FROM departments 
    WHERE id = 1
    UNION ALL
    SELECT d.id, d.name, d.parent_id
    FROM departments d
    INNER JOIN org_tree ot ON d.parent_id = ot.id
)
SELECT * FROM org_tree;</code></pre>
                        </div>
                    </div>
                </div>
                
                <!-- Feature 2 -->
                <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-3">
                            <div class="w-8 h-8 bg-indigo-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-chart-line text-indigo-600"></i>
                            </div>
                            <h3 class="text-xl font-bold">3.2 窗口函数</h3>
                        </div>
                        <p class="text-gray-600 mb-4">强大的数据分析利器，无需自连接</p>
                        <div class="code-block p-4 text-xs">
                            <pre><code>SELECT 
    product_id,
    sales_date,
    daily_sales,
    AVG(daily_sales) OVER (PARTITION BY product_id 
                          ORDER BY sales_date 
                          ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) 
    AS 7d_avg
FROM product_sales;</code></pre>
                        </div>
                    </div>
                </div>
                
                <!-- Feature 3 -->
                <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-3">
                            <div class="w-8 h-8 bg-indigo-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-eye-slash text-indigo-600"></i>
                            </div>
                            <h3 class="text-xl font-bold">3.3 不可见索引</h3>
                        </div>
                        <p class="text-gray-600 mb-4">安全调优，测试不影响生产</p>
                        <div class="code-block p-4 text-xs">
                            <pre><code>ALTER TABLE users ADD INDEX idx_phone (phone) INVISIBLE;
-- 测试期间不影响生产
SELECT * FROM users USE INDEX (idx_phone) WHERE phone = '13800138000';
-- 确认有效后设为可见
ALTER TABLE users ALTER INDEX idx_phone VISIBLE;</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Case Studies -->
        <section id="cases" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-600 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold">四、实战案例：三大典型场景优化</h2>
            </div>
            
            <!-- Case 1 -->
            <div class="card bg-white rounded-xl shadow-lg overflow-hidden mb-8">
                <div class="p-6">
                    <h3 class="text-2xl font-bold mb-4 highlight">4.1 案例一：订单分页优化</h3>
                    <div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6">
                        <h4 class="font-bold text-red-700 mb-2">问题SQL：</h4>
                        <div class="code-block p-4">
                            <pre class="text-sm"><code>SELECT * FROM orders 
WHERE user_id = 1001 
ORDER BY create_time DESC 
LIMIT 100000, 20; -- 10万条后取20条</code></pre>
                        </div>
                    </div>
                    <div class="bg-green-50 border-l-4 border-green-500 p-4">
                        <h4 class="font-bold text-green-700 mb-2">优化方案：</h4>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm"><code>-- 8.0新特性：降序索引
ALTER TABLE orders ADD INDEX idx_user_created (user_id, create_time DESC);

-- 优化后分页
SELECT * FROM orders 
WHERE user_id = 1001 AND create_time < '2023-06-01'
ORDER BY create_time DESC 
LIMIT 20;</code></pre>
                        </div>
                        <p class="text-green-700"><i class="fas fa-lightbulb mr-2"></i><strong>优化效果：</strong> 查询时间从3.2秒降至120毫秒</p>
                    </div>
                </div>
            </div>
            
            <!-- Case 2 -->
            <div class="card bg-white rounded-xl shadow-lg overflow-hidden mb-8">
                <div class="p-6">
                    <h3 class="text-2xl font-bold mb-4 highlight">4.2 案例二：用户登录锁竞争</h3>
                    <div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6">
                        <h4 class="font-bold text-red-700 mb-2">问题现象：</h4>
                        <p class="text-gray-700">高并发下出现大量<code class="bg-red-100 px-1 rounded">lock wait timeout</code>错误</p>
                    </div>
                    <div class="bg-green-50 border-l-4 border-green-500 p-4">
                        <h4 class="font-bold text-green-700 mb-2">解决方案：</h4>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm"><code>-- 使用8.0新锁机制
SET GLOBAL innodb_deadlock_detect = ON;
SET GLOBAL innodb_lock_wait_timeout = 3;

-- 配合应用层重试机制
public boolean login(Long userId) {
    for (int i = 0; i < 3; i++) {
        try {
            return doLogin(userId);
        } catch (LockTimeoutException e) {
            Thread.sleep(50);
        }
    }
    return false;
}</code></pre>
                        </div>
                        <p class="text-green-700"><i class="fas fa-lightbulb mr-2"></i><strong>优化效果：</strong> 登录失败率从15%降至0.5%</p>
                    </div>
                </div>
            </div>
            
            <!-- Case 3 -->
            <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                <div class="p-6">
                    <h3 class="text-2xl font-bold mb-4 highlight">4.3 案例三：日志表性能优化</h3>
                    <div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6">
                        <h4 class="font-bold text-red-700 mb-2">原始表结构：</h4>
                        <div class="code-block p-4">
                            <pre class="text-sm"><code>CREATE TABLE app_log (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    log_time DATETIME,
    content TEXT
);</code></pre>
                        </div>
                    </div>
                    <div class="bg-green-50 border-l-4 border-green-500 p-4">
                        <h4 class="font-bold text-green-700 mb-2">8.0优化方案：</h4>
                        <div class="code-block p-4 mb-4">
                            <pre class="text-sm"><code>-- 使用JSON类型和生成列
CREATE TABLE app_log (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    log_time DATETIME(6),
    log_data JSON,
    log_level VARCHAR(10) GENERATED ALWAYS AS (log_data->>"$.level"),
    INDEX idx_log_time (log_time)
) PARTITION BY RANGE (YEAR(log_time)) (
    PARTITION p2022 VALUES LESS THAN (2023),
    PARTITION p2023 VALUES LESS THAN (2024)
);</code></pre>
                        </div>
                        <p class="text-green-700"><i class="fas fa-lightbulb mr-2"></i><strong>优化效果：</strong> 查询性能提升8倍，存储空间节省30%</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Advanced Techniques -->
        <section id="advanced" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-600 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold">五、高级调优技巧：DBA的私房秘籍</h2>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6 mb-10">
                <!-- Technique 1 -->
                <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 bg-indigo-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-magic text-indigo-600"></i>
                            </div>
                            <h3 class="text-xl font-bold">5.1 查询重写黑魔法</h3>
                        </div>
                        <div class="code-block p-4 text-xs mb-3">
                            <pre><code>-- 原始查询（执行时间2.3秒）
SELECT DISTINCT u.* FROM users u
WHERE EXISTS (
    SELECT 1 FROM orders o 
    WHERE o.user_id = u.id AND o.amount > 1000
);</code></pre>
                        </div>
                        <div class="code-block p-4 text-xs">
                            <pre><code>-- 优化后（执行时间0.15秒）
SELECT u.* FROM users u
INNER JOIN (
    SELECT DISTINCT user_id FROM orders 
    WHERE amount > 1000
) o ON u.id = o.user_id;</code></pre>
                        </div>
                    </div>
                </div>
                
                <!-- Technique 2 -->
                <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 bg-indigo-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-cog text-indigo-600"></i>
                            </div>
                            <h3 class="text-xl font-bold">5.2 配置参数黄金组合</h3>
                        </div>
                        <div class="code-block p-4 text-xs">
                            <pre><code># my.cnf 优化配置
[mysqld]
innodb_buffer_pool_size = 16G      # 内存的70-80%
innodb_flush_log_at_trx_commit = 2 # 平衡安全与性能
transaction_isolation = READ-COMMITTED
max_connections = 1000
thread_cache_size = 100</code></pre>
                        </div>
                    </div>
                </div>
                
                <!-- Technique 3 -->
                <div class="card bg-white rounded-xl shadow-lg overflow-hidden">
                    <div class="p-6">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 bg-indigo-100 rounded-full flex items-center justify-center mr-3">
                                <i class="fas fa-search text-indigo-600"></i>
                            </div>
                            <h3 class="text-xl font-bold">5.3 性能分析三板斧</h3>
                        </div>
                        <div class="space-y-4">
                            <div>
                                <h4 class="font-semibold mb-1">1. 慢查询日志</h4>
                                <div class="code-block p-2 text-xs">
                                    <pre><code>SET GLOBAL slow_query_log = 1;
SET GLOBAL long_query_time = 1;</code></pre>
                                </div>
                            </div>
                            <div>
                                <h4 class="font-semibold mb-1">2. 性能模式</h4>
                                <div class="code-block p-2 text-xs">
                                    <pre><code>SELECT * FROM sys.statement_analysis 
ORDER BY avg_latency DESC LIMIT 10;</code></pre>
                                </div>
                            </div>
                            <div>
                                <h4 class="font-semibold mb-1">3. InnoDB监控</h4>
                                <div class="code-block p-2 text-xs">
                                    <pre><code>SHOW ENGINE INNODB STATUS\G</code></pre>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Future Features -->
        <section id="future" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-600 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold">六、未来已来：8.0新特性演进方向</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-lg p-8">
                <div class="grid md:grid-cols-3 gap-6">
                    <!-- Feature 1 -->
                    <div>
                        <h3 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-atom text-indigo-500 mr-2"></i>
                            1. 原子DDL
                        </h3>
                        <p class="text-gray-600 mb-4">安全修改大表结构，避免元数据锁定问题</p>
                        <div class="code-block p-3 text-xs">
                            <pre><code>ALTER TABLE billion_rows_table 
ADD INDEX idx_new_column (new_column),
ALGORITHM=INPLACE, LOCK=NONE;</code></pre>
                        </div>
                    </div>
                    
                    <!-- Feature 2 -->
                    <div>
                        <h3 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-tasks text-indigo-500 mr-2"></i>
                            2. 资源组管理
                        </h3>
                        <p class="text-gray-600 mb-4">为不同工作负载分配CPU资源</p>
                        <div class="code-block p-3 text-xs">
                            <pre><code>CREATE RESOURCE GROUP report_group
TYPE = USER
VCPU = 4-6
THREAD_PRIORITY = 10;</code></pre>
                        </div>
                    </div>
                    
                    <!-- Feature 3 -->
                    <div>
                        <h3 class="text-xl font-bold mb-3 flex items-center">
                            <i class="fas fa-chart-bar text-indigo-500 mr-2"></i>
                            3. 直方图统计
                        </h3>
                        <p class="text-gray-600 mb-4">改进非均匀数据分布的查询优化</p>
                        <div class="code-block p-3 text-xs">
                            <pre><code>ANALYZE TABLE products 
UPDATE HISTOGRAM ON price 
WITH 100 BUCKETS;</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Final Advice -->
        <section id="advice" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-600 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold">七、调优大师的终极忠告</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-lg p-8">
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <h3 class="text-2xl font-bold mb-6 flex items-center">
                            <i class="fas fa-exclamation-triangle text-yellow-500 mr-3"></i>
                            调优四大准则
                        </h3>
                        <ul class="space-y-4">
                            <li class="flex items-start">
                                <div class="flex-shrink-0 h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-chart-line text-indigo-600 text-sm"></i>
                                </div>
                                <p><strong>监测先行：</strong>没有指标就不要优化</p>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-step-forward text-indigo-600 text-sm"></i>
                                </div>
                                <p><strong>循序渐进：</strong>每次只改一个参数</p>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-shield-alt text-indigo-600 text-sm"></i>
                                </div>
                                <p><strong>敬畏生产：</strong>变更前必做备份</p>
                            </li>
                            <li class="flex items-start">
                                <div class="flex-shrink-0 h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-tools text-indigo-600 text-sm"></i>
                                </div>
                                <p><strong>善用工具：</strong>专业工具事半功倍</p>
                            </li>
                        </ul>
                    </div>
                    
                    <div>
                        <h3 class="text-2xl font-bold mb-6 flex items-center">
                            <i class="fas fa-wrench text-blue-500 mr-3"></i>
                            推荐工具集
                        </h3>
                        <div class="grid grid-cols-2 gap-4">
                            <div class="bg-blue-50 p-4 rounded-lg">
                                <h4 class="font-bold text-blue-700 mb-1">pt-query-digest</h4>
                                <p class="text-sm text-gray-600">分析慢查询日志</p>
                            </div>
                            <div class="bg-blue-50 p-4 rounded-lg">
                                <h4 class="font-bold text-blue-700 mb-1">sysbench</h4>
                                <p class="text-sm text-gray-600">进行压力测试</p>
                            </div>
                            <div class="bg-blue-50 p-4 rounded-lg">
                                <h4 class="font-bold text-blue-700 mb-1">MySQL Shell</h4>
                                <p class="text-sm text-gray-600">管理InnoDB Cluster</p>
                            </div>
                            <div class="bg-blue-50 p-4 rounded-lg">
                                <h4 class="font-bold text-blue-700 mb-1">Percona PMM</h4>
                                <p class="text-sm text-gray-600">监控与分析</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Test Case -->
        <section class="mb-20">
            <div class="bg-indigo-50 rounded-xl p-8">
                <h3 class="text-2xl font-bold mb-4 flex items-center">
                    <i class="fas fa-vial text-indigo-600 mr-3"></i>
                    最后测试
                </h3>
                <p class="mb-6">创建一个测试表并插入100万数据，验证您的优化效果：</p>
                <div class="code-block p-4">
                    <pre class="text-sm"><code>-- 创建测试数据
CREATE TABLE stress_test (
    id INT PRIMARY KEY AUTO_INCREMENT,
    data VARCHAR(100),
    INDEX idx_data (data)
) ENGINE=InnoDB;

-- 插入100万测试数据
INSERT INTO stress_test (data)
SELECT MD5(RAND()) FROM 
JSON_TABLE('[1,2,3,4,5,6,7,8,9,10]', "$[*]" COLUMNS(id FOR ORDINALITY)) AS t1
JOIN 
JSON_TABLE('[1,2,3,4,5,6,7,8,9,10]', "$[*]" COLUMNS(id FOR ORDINALITY)) AS t2;</code></pre>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="footer py-8">
        <div class="container mx-auto px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white">技术小馆</h3>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300">
                        <i class="fas fa-link mr-2"></i>http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>